class code2 {
    //原地算法
    public int removeElement(int[] nums, int val) {
        int count = 0;
        for(int x:nums) {
            if(x != val) {
                nums[count++] = x;
            }
        }
        return count;
    }
}